package com.cumt.threeway.fragment;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cumt.threeway.R;
import com.cumt.threeway.activity.DetailActivity;
import com.cumt.threeway.model.Single;
import com.cumt.threeway.table.ActivitiesEntity;

/**
 * Created by 胡晶晶 on 2016/5/22.
 */
public class AbstractFragment extends Fragment {

    private TextView mAbstractTextView;
    private Single mSingle;
    private Context mContext;

    public static AbstractFragment newInstance(Single single) {
        AbstractFragment abstractFragment = new AbstractFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("single", single);
        abstractFragment.setArguments(bundle);
        return abstractFragment;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        Bundle bundle = getArguments();
        mContext = activity;
//        mSingle = (Single) bundle.getSerializable("single");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_classify_baoming_gaiyao, null);
        initView(view);
        return view;
    }

    private void initView(View view) {
        mAbstractTextView = (TextView) view.findViewById(R.id.tv_classify_baoming_gaiyao);
//        mAbstractTextView.setText("\u3000\u3000" + mSingle.getSummary());
        ActivitiesEntity activitiesEntity = ((DetailActivity)mContext).getActivitiesEntity();
        mAbstractTextView.setText(activitiesEntity.getDetail());
    }
}
